import { NewLineKind } from "typescript";
import { Context } from "../class/Context";
import { Debuff } from "../class/Effect";
import { Hurt } from "../class/Hurt";
import { Method } from "../class/Method";
import { Role } from "../class/Role";

/**
 * 策划特权
 */
export class CeHuaTeQuan extends Method {
    // role：Debuff 生效的角色
    // myRole: 释放技能的角色
    static methodName = "策划特权"
    public CD: number = 30E3;
    public describe: string = "策划第一只宠物的技能,造成 170(PA) + 410 点物理伤害 , 170(MA) + 200 点法术伤害,并附加诅咒效果,诅咒效果期间每1秒扣除 110 HP,持续10秒";
    public invoke(context: Context): void {
        const itld = context.nextParam();
        const it = this.masterRole.game.getRole(itld)
        /** 诅咒效果 */
        class Curse extends Debuff {

            public sumTime: number = 10E3;
            public eachTime: number = 1E3;
            constructor(masterRole: Role, private role: Role) {
                super(masterRole)
            }
            public invoke(): void {
                // masterRole:目标,role:释放技能人
                this.masterRole.onHurt(this.role, new Hurt(0, 0, 110))
            }
        }

        it.addEffect(new Curse(it, this.masterRole));// masterRole:释放技能的人,it 目标
        // 造成的额外伤害
        const PA = Math.floor(this.masterRole.getPhysicsAttack() * 1.9) + 410; // 
        const MA = Math.floor(this.masterRole.getMagicAttack() * 1.7) + 200
        //造成的固伤
        it.onHurt(this.masterRole, new Hurt(PA, MA, 0))
    }

}